﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using Ras2Logic;
using Ras2Web;

namespace Ras2Web
{
    /// <summary>
    /// Klasinn HitListDetail
    /// </summary>
    public partial class HitListDetail : System.Web.UI.Page
    {
        /// <summary>
        /// Fall sem setur inn vinsældarlista á vefsíðuna.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            HitListController ctrl = new HitListController();
           
            if (!this.IsPostBack)
            {
                String strID = Request.QueryString["ID"];
                int nID = 0;
                if (Int32.TryParse(strID, out nID))
                {
                    HitList hitList = ctrl.GetHitListById(nID);

                    if (hitList != null)
                    {
                        m_gridViewSongsAndPerformer.DataSource = ctrl.GetAllHitListEntries(nID);
                        m_gridViewSongsAndPerformer.DataBind();
                        m_name.Text = hitList.Name;
                        m_id.Text = Convert.ToString(hitList.ID);
                    }
                }
            }
        }
    }
}
